<template>
      <div id="authorization">
            <el-dialog
                  title="代理商审核"
                  :visible.sync="shenhe.show"
                  width="50%"
                  >
                  <div class="form">
                        <el-form >
                              <el-form-item label="拒绝原因" label-width="100px">
                                    <el-input  v-model='tableData.explain'></el-input>
                              </el-form-item>
                        </el-form>
                  </div>
                  <span slot="footer" class="dialog-footer">
                  <el-button @click="shenhe.show = false">取 消</el-button>
                  <el-button type="primary" @click="SubForm">确 定</el-button>
                  </span>
                  </el-dialog>
      </div>
</template>

<script>
      export default {
            props: {
                  tableData: Object,
                  shenhe: Object
            },
            computed: {
                  token() {
                        return localStorage.miniToken;
                  }
            },
            methods: {
                  //  提交表单
                  async SubForm() {
                       // console.log(this.tableData);
                       // console.log(this.token);
                        
                        let { id, explain, status } = this.tableData
                        let res = await this.$axios.post("/admin/user/ismaster", {
                              id,
                              status,
                              explain,
                              token: this.token,
                        })
                        console.log(res);
                        let code = res.data.code
                        if (code == 204) {
                              this.$message.success("更新成功")
                              this.shenhe.show = false
                              this.tableData = {
                                    id: "",
                                    status: "",
                                    explain: ""
                              }
                        }
                        
                  },
            }
      }
</script>

<style lang="scss" scoped>

</style>